<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>聚易社区</title>
<link rel="stylesheet" type="text/css" href="${ctx}/index/css/layout.css"/>
<script src="${ctx}/js/jquery1.6.js" type="text/javascript"></script>
<script src="${ctx}/js/Verification.js" type="text/javascript"></script>
<script src="${ctx}/index/js/zDialog.js" type="text/javascript"></script>
<script src="${ctx}/index/js/zDrag.js" type="text/javascript"></script>
</head>
<body id="index">
<script type="text/javascript">
    //鼠标点击时触事件
  $(function (){
	  $('form :input').click(function (){
	        var $parent = $(this).parent();
	      //  $parent.find(".formtips").remove();
	        if($(this).is('#user_email')){
	        	  $("#emailmessage").empty(); 
	        	  $("#emailmessage").removeAttr("class");
	            var $emailmessage = $("#emailmessage");
	            $("#emailmessage").addClass("formtips onSuccess");
	         	     var errorMsg = '请输入您常用的邮箱，方便日后找回密码。';
	         	     $emailmessage.append(errorMsg);
	          }

	        if($(this).is('#user_name')){
	        	  $("#namemessage").empty(); 
	        	  $("#namemessage").removeAttr("class");
	            var $emailmessage = $("#namemessage");
	            $("#namemessage").addClass("formtips onSuccess");
	         	     var errorMsg = '4-16个字符，1个中文等于2个字符，一旦注册成功用户名不能修改。';
	         	     $emailmessage.append(errorMsg);
	          }
	       
	        if($(this).is('#user_password')){
	        	  $("#passwordmessage").empty(); 
	        	  $("#passwordmessage").removeAttr("class");
	            var $emailmessage = $("#passwordmessage");
	            $("#passwordmessage").addClass("formtips onSuccess");
	         	     var errorMsg = '由6-20个英文字母、数字或符号组成。';
	         	     $emailmessage.append(errorMsg);
	          }
	      
	        if($(this).is('#user_repassword')){
	        	  $("#repasswordmessage").empty(); 
	        	  $("#repasswordmessage").removeAttr("class");
	            var $emailmessage = $("#repasswordmessage");
	            $("#repasswordmessage").addClass("formtips onSuccess");
	         	     var errorMsg = '重复上面的密码。';
	         	     $emailmessage.append(errorMsg);
	          }

	        if($(this).is('#code')){
	        	  $("#veriCodemessage").empty(); 
	        	  $("#veriCodemessage").removeAttr("class");
	            var $emailmessage = $("#veriCodemessage");
	            $("#veriCodemessage").addClass("formtips onSuccess");
	         	     var errorMsg = '输入图片中的字符。';
	         	     $emailmessage.append(errorMsg);
	          }
			 });
// 鼠标离开时触发事件
	    $('form :input').blur(function(){
           var $parent = $(this).parent();
           $parent.find(".formtips").remove();

          //验证邮箱
           if($(this).is('#user_email')){
        	   $("#emailmessage").empty();
               var $emailmessage = $("#emailmessage");
               $("#emailmessage").removeAttr("class");
               if(this.value=="" || (this.value !="" && !/.+@.+\.[a-zA-Z]{2,4}$/.test(this.value))){
            	   $("#emailmessage").empty();
            	     var errorMsg = '请输入正确的E-Mail地址.';
            	     $("#emailmessage").addClass("formtips onError");
            	     $emailmessage.append(errorMsg);
                   }else{
                        $.post("${ctx}/UserManager/user!isEmail.action",{"user.userEmail":this.value},function(data,textStatus){
                        	var str = eval("("+data+")");
                        	if(str.flag==true){
                        		$("#emailmessage").empty();
                            	var errorMsg = '该邮箱已被使用！';
                            	 $("#emailmessage").addClass("formtips onError");
                       	     $emailmessage.append(errorMsg);
                             }else{
                            	 $("#emailmessage").empty();
                            	   var okMsg = '恭喜您邮箱可以使用！.';
                            	   $("#emailmessage").addClass("formtips onSuccess");
            					   $emailmessage.append(okMsg);
                             }
                         });
                   }
             }
             //验证用户名   
           if($(this).is('#user_name')){
        	   $("#namemessage").empty();
        	   $("#namemessage").removeAttr("class");
        	   var  $namemessage = $("#namemessage");
        	   var username = strTrim(this.value);
                 if(username==""){
                	 var errorMsg = '请输入的用户名.';
                	   $("#namemessage").addClass("formtips onError");
                     $namemessage.append(errorMsg);
                    }else if(username.length < 4 || username.length > 16){
                         var namelength = username.length;
                    	 var errorMsg = '您输入的用户名长度为';
                    	 if(namelength<4){
                           var str = 4- namelength;
                           $("#namemessage").addClass("formtips onError");
                    	$namemessage.append(errorMsg+':'+namelength+'位,需要再输入:'+str+'位.');
                        }else{
                        	  var str = namelength-16;
                        	  $("#namemessage").addClass("formtips onError");
                           $namemessage.append(errorMsg+':'+namelength+'位,需要减去入:'+str+'位.');
                       }
                    }else{
                    	var okMsg = '输入正确.';
                    	$("#namemessage").addClass("formtips onSuccess");
					    $namemessage.append(okMsg);
                     }
               }
            // 验证密码

           if($(this).is('#user_password')){
        	   $("#passwordmessage").empty();
        	   $("#passwordmessage").removeAttr("class");
        	   var  $namemessage = $("#passwordmessage");
        	   var userpassword  = strTrim(this.value);
                 if(userpassword==""){
                	 var errorMsg = '请输入密码.';
                	   $("#passwordmessage").addClass("formtips onError");
                     $namemessage.append(errorMsg);
                    }else if(userpassword.length < 6 || userpassword.length > 20){
                         var passwordlength = userpassword.length;
                    	 var errorMsg = '您输入的密码长度为';
                    	 if(passwordlength<6){
                           var str = 6- passwordlength;
                           $("#passwordmessage").addClass("formtips onError");
                    	$namemessage.append(errorMsg+':'+passwordlength+'位,需要再输入:'+str+'位.');
                        }else{
                        	  var str = passwordlength-20;
                        	   $("#passwordmessage").addClass("formtips onError");
                           $namemessage.append(errorMsg+':'+passwordlength+'位,需要减去入:'+str+'位.');
                       }
                    }else{
                    	   var okMsg = '输入正确.';
                    	   $("#passwordmessage").addClass("formtips onSuccess");
					       $namemessage.append(okMsg);
                     }
               }
          //验证密码是否相等
           if($(this).is('#user_repassword')){
        	   $("#repasswordmessage").empty();
        	   $("#repasswordmessage").removeAttr("class");
        	   var  $namemessage = $("#repasswordmessage");
        	   var userrepassword  = strTrim(this.value);
        	   var usepassword  = $("#user_password").val();
                 if(userrepassword =="" || userrepassword != usepassword){
                	 var errorMsg = '密码错误!';
                	   $("#repasswordmessage").addClass("formtips onError");
                     $namemessage.append(errorMsg);
                    }else{
                    	var okMsg = '输入正确.';
                    	 $("#repasswordmessage").addClass("formtips onSuccess");
					    $namemessage.append(okMsg);
                     }
               }


           // 验证码验证
           if($(this).is('#code')){ 
               var code = $("#code").val();
        	   $("#veriCodemessage").empty();
        	   $("#veriCodemessage").removeAttr("class");
        	   var  $codemessage = $("#veriCodemessage");
        	   if(this.value==""){
        		   var errorMsg = '请输入验证码!';
        		   $("#veriCodemessage").addClass("formtips onError");
                   $codemessage.append(errorMsg);
            	}else if(code.length<4){
            		 var errorMsg = '请输入验证码!';
          		   $("#veriCodemessage").addClass("formtips onError");
                     $codemessage.append(errorMsg);
                	}else{
            		$.post("${ctx}/UserManager/user!isCode.action",{"code":code},function(data,textStatus){
            			var str = eval("("+data+")");
                          if(str.flag==true){
                              var okMsg = '验证码正确！';
                              $("#veriCodemessage").addClass("formtips onSuccess");
                 				 $codemessage.append(okMsg);
                           }else{
                                var errorMsg = '验证码错误!';
                                $("#veriCodemessage").addClass("formtips onError");
                                $codemessage.append(errorMsg);
                               }
                		});
                	}
             }
         
           
  
           }).keyup(function(){
    		   $(this).triggerHandler("blur");
   		}).focus(function(){
   	  	   $(this).triggerHandler("blur");
   		});

		//提交，最终验证。
		 $('#send').click(function(){
				$("form :input.required").trigger('blur');
				var numError = $('form .onError').length;
				if(numError){
					return false;
				} 
				//alert("注册成功,密码已发到你的邮箱,请查收.");
		 });
   })
   

 function getVerCode(){
	 document.verCodePic.src="${ctx}/index/images/image.jsp?id="+Math.random();
	 }
    
</script>
<div class="head">
    <h1><a href="index.php"><img alt="jooyea" src="${ctx}/index/images/snslogo.gif"></a></h1>
    <div class="search">
        <div class="schbox">
           <form class="search_box" action="index.php" target="_blank" onsubmit="clear_def(this,'输入姓名...');">
            <input id="searchtop_input" maxlength='20' class="inpt" type="text" name='memName' value="输入姓名..." onblur="inputTxt(this,'set');" onfocus="inputTxt(this,'clean');" />
            <input class="btn" type="submit" value="" />
        	<input type='hidden' name='tg' value='search_pals_list' />
        </form>
        </div>
        <a href="javascript:goLogin();">高级搜索</a>
    </div>
</div>
<div class="clear"></div>
<div class="top_bg">
	<div class="nav">
	  <span class="left">
	    <a href="index.php">首页</a>
	    <a href="index.php?tg=search_pals_list&online=1">看谁在线</a>
	    <a href="help/help.html">帮助</a>
		</span>
	  <span class="right">
		  <a href="javascript:addBookMark();">加入收藏</a>
		  <a href="javascript:setMyHomepage('http://${ctx}/iwebsns/');">设为首页</a>
		  <a href="modules.php?app=user_reg">注册</a>
		  <a href="index.php">请登录</a>
	  </span>
	</div>
</div>
<div class="container">
	<div class="wrapper">
        <div class="main">
            <div class="reg_container">
                <ul class="regedit">
                <h2>快速注册</h2>
                  <form action="${ctx}/UserManager/user!register.action" id="reg_form" name="reg_form" method="post">
                    <input type='hidden' name='invite_code' value='' />
                    <li><label>邮箱：</label>  
                    </li>
                    <li>
                        <input class="required" name="user.userEmail" id="user_email" />
                    </li>
                    <li class="gray">
                      <div id="emailmessage"></div>
                    </li>
                    <li><label>用户名：</label></li>
                    <li>
                      <input class="required" name="user.userName" id="user_name" autocomplete="off" />
                    </li>
                    <li class="gray">
                    <div id="namemessage"></div>
                    </li>
                    <li><label>密码：</label></li>
                    <li>
                      <input class="required" type="password" name="user.userPws" id="user_password" autocomplete="off" />
                    </li>
                    <li class="gray"> 
                    <div id="passwordmessage" class="hint"></div>
                    </li>
                    <li><label>重新输入密码：</label></li>
                    <li>
                      <input class="required" type="password" name="userPws" id="user_repassword" />
                      
                    </li>
                    <li class="gray">
                     <div id="repasswordmessage" class="hint highlight"></div>
                      </li> </li>
                    <li><label>您的性别：</label>
                      <input type='radio' value='1' style="vertical-align:middle" name='user.userSex' />男    <input type='radio' value='0' style="vertical-align:middle" name='user.userSex' checked=checked />女                      <div id="user_repassword_message" class="hint highlight"></div>
                    </li>
                    <li class="gray">选择您的性别，一旦注册成功性别不能修改。 </li>
                    
                    <li>
                    <label>验证码：</label>
                      <input class="required" type="text" style="width:80px; " name="code" id="code" maxlength="5"  />
                      <img style=" margin-left:12px;" border="0" src="${ctx}/index/images/image.jsp" name="verCodePic" id="verCodePic" />
                      <a href="javascript:getVerCode();">看不清？</a></li>
                    <li class="gray">
                    <div id="veriCodemessage" class="hint highlight"></div>
                    </li>
                    <li><input class="button" type="submit" value="注册" id="send" /><span>接受<a href="javascript:ser_item();">《用户协议》</a>并注册</span></li>
                    </form>
                </ul>
                <div class="clear"></div>
            </div>
  		</div>  
  </div>  
</div>  

 

<div class="foot">
	<a href="about/about.html">关于我们</a>
	<a href="about/privacy.html">隐私安全</a>
	<a href="http://tech.jooyea.com/bbs/">开发者社区</a>
	<a href="mailto:">联系邮件</a>Powered by <strong>iWeb<b>SNS</b>1.0</strong> &copy; 2009-2010 Jooyea.net</div>
<div style="display: none;" class="emBg" id="face_list_menu"></div>
<div id="append_parent"></div>
</body>

</html>
